<?php
namespace backend\models;
use yii\db\ActiveRecord;
/**
 * Created by PhpStorm.
 * User: 张
 * Date: 2015/9/23
 * Time: 21:33
 */
class Article extends ActiveRecord{
    public static function tableName()
    {
        return '{{%article}}';
    }
    public function rules()
    {
        return[
            //不经过验证的数据是不会写到数据库里的，因此数据在这里都要做一下验证
            ['status','required'],
            [['title','category'],'required'],
            [['thumbnail'],'file','extensions' => ['jpg','png','gif'],'uploadRequired'=>'请上传文件!','message'=>'上传失败!'],
        ];
    }
}
?>
